package za.org.jcicada.cfgmngr.impl;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import za.org.jcicada.cfgmngr.IConfigurationClient;
import za.org.jcicada.cfgmngr.IConfigurationServer;
import za.org.jcicada.cfgmngr.IPhysicalServer;
import za.org.jcicada.cfgmngr.ISystemSubject;
import za.org.jcicada.cfgmngr.SystemSetType;
import za.org.jcicada.genss.ServiceURN;
import za.org.jcicada.genss.SystemURN;

public class StubConfigurationServer implements IConfigurationServer {

	public IConfigurationClient client;
	public boolean disconnected = false;
	public URI locationURI;
	public List<ServiceURN> serviceURNs = new ArrayList<ServiceURN>();
	public ServiceURN serviceURN;
	public SystemURN systemURN;
	public String protocol;
	public SystemSetType type;
	public int requestLocateServiceCount = 0;
	
	public ISystemSubject getSystemSubject() {
		return null;
	}
	
	public IPhysicalServer getPhysicalServer() {
		return null;
	}

	public void informDisconnect(IConfigurationClient client) {
		this.client = client;
		this.disconnected = true;
	}

	public void requestDeregisterService(IConfigurationClient client, URI locationURI, ServiceURN serviceURN) {
		this.client = client;
		this.locationURI = locationURI;
		this.serviceURN = serviceURN;
	}

	public void requestDeregisterSystem(IConfigurationClient client, SystemURN systemURN) {
		this.client = client;
		this.systemURN = systemURN;
	}

	public void requestGetConfiguration(IConfigurationClient client, SystemURN systemURN) {
		this.client = client;
		this.systemURN = systemURN;
	}

	public void requestLocateService(IConfigurationClient client, ServiceURN serviceURN, String protocol) {
		this.requestLocateServiceCount++;
		this.client = client;
		this.serviceURN = serviceURN;
		this.protocol = protocol;
	}

	public void requestRegisterService(IConfigurationClient client, URI locationURI, ServiceURN serviceURN) {
		this.client = client;
		this.locationURI = locationURI;
		this.serviceURN = serviceURN;
		this.serviceURNs.add(serviceURN);
	}

	public void requestRegisterSystem(IConfigurationClient client, SystemURN systemURN) {
		this.client = client;
		this.systemURN = systemURN;
	}

	public void requestSensorSet(IConfigurationClient client, SystemURN systemURN) {
		this.client = client;
		this.systemURN = systemURN;
	}

	public void requestSystemSet(IConfigurationClient client, SystemSetType type) {
		this.client = client;
		this.type = type;
	}
	
	public void requestServiceSet(IConfigurationClient client, SystemURN systemURN) {
		this.client = client;
		this.systemURN = systemURN;
	}

}
